/**
 * 工厂类，根据传参来实例化出对应的对象
 * @author liaosh
 * @date 2022-10-15 21:28
 */
public class OperationFactory {
    public static Operation createOperation(String operate) {
        Operation operation = null;
        switch(operate) {
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            case "*":
                operation = new OperationMul();
                break;
            case "/":
                operation = new OperationDiv();
                break;
        }
        return operation;
    }
}
